<extend name="Public/base" />
<block name="style">
<style>
	.page-content{padding:15px 10px;}
	.search_pannl_div .single-col label{width:75px;} 
</style>
</block>
<block name="body">
  <include file="Public:artdialog" />

<div class="row">
   <div class="col-md-12">
       <div class="block-web">
   <!-- 商品列表 -->
   <form action="{:U('index')}" method="post"  id="SearchFrom">
           <div class="bgmain">
             <div class="header">
                  <div class="actions_diy">
                           <a href="{:U('getwxuser',array('op'=>$op))}"  class="btn btn-default btn-primary">
                               <i class="fa fa-plus"></i>获取微信用户
                           </a>
                       </div>
                     <h3 class="content-header">微信列表</h3>
                 </div> 
                   <div class="block-web" style="margin: 0;padding:10px 20px 0px 0px;">
                       <div class="porlets-content">
                           <div class="row" style="margin-left:-45px;">
                               <div class="col-md-12">
                                   <div class="search_pannl_div">
                                       <table class="search_table">
                                           <tbody>
                                               <tr>
                                             <td class="single-col"> 
                                                       <label>关键词：</label><input style="width:120px;" type="text" id="keyword" name="keyword" placeholder="输入关键字" value="">
                                                       <input type="hidden" name="op" value="{$op}"/>
                                                       <button type="button" class="btn btn-success" formtarget="SearchFrom" id="searchBtn" ><i class="fa fa-search"></i> 搜索</button>  
                                                   </td>
                                               </tr>
                                           </tbody>
                                       </table>
                                   </div>
                               </div>
                           </div>
                       </div>
                   </div>
        </div>

   <div id="load_tb_div" style="padding:10px 0px 30px ;">
     <div class="table-responsive">
            <table id="sample-table-1"
              class="table table-striped table-bordered table-hover">
              <thead>
                <tr> 
                  <th>头像</th>
                  <th>昵称</th> 
                  <th>性别</th> 
                  <th>地址</th>   
                  <th>备注</th>   
                  <th>添加时间</th>
                  <if condition="$op neq 1">
                  <th>操作</th>
                  </if>
                </tr> 
              </thead> 
              <tbody> 
                <volist name="list" id="o">
                <tr> 
                  <th><img src="{$o.headimgurl}" width="90px" width="90px"></th>
                  <th>{$o.nickname}</th> 
                  <th>{$o['sex']==1?'男':'女'}</th>
                  <th>{$o.country}/{$o.province}/{$o.city}</th> 
                  <th>{$o.remark}</th> 
                  <th>{$o.createtime}</th> 
                  <if condition="$op neq 1">
                  <td><a href="javascript:;" onclick="reupdate(this)" field='"openid":"{$o.openid}","nickname":"{$o.nickname}","sex":"{$o.sex}","country":"{$o.country}","province":"{$o.province}","city":"{$o.city}"'
                    class="btn btn-white btn-sm">选择</a></td>
                  </if>
                </tr>
                </volist>
              </tbody>
            </table>
            <div class="pagination" style="margin:0px;">
                {$page}
            </div>
          </div> 
   </div>
           </form>
       </div><!--/porlets-content-->
   </div><!--/block-web-->
</div><!--/col-md-12-->
</block>
<block name="script">
<script type="text/javascript" src="__PUBLIC__/Admin/js/common_manage.js""></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/json2.js"></script>
<script type="text/javascript"> 
//定义cookiename
var cookiename="wxinfo_<?php echo UID; ?>";
$(function(){
$('#searchBtn').bind("click",function(){$('#SearchFrom').submit();});
});

var reupdate=function(obj){ 

	var _tmv="{"+$(obj).attr("field")+"}";
	var _json=JSON.parse(_tmv); 
	if(!_json)return; 
	
    //考虑重复记录的清理。  
    setCookie(cookiename,"",-10);
    
    var _db=JSON.stringify(_json);
	setCookie(cookiename,_db,1);   
	
   var win=   art.dialog.opener; 
    win.fnsetwxinfo();
    art.dialog.close(); 
}  
 </script>
</block>
